home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / batchRenderWindow.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.0 KB  |  164 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global int $localHostRenderStatus = 0;
  18. global int $gNumProcessorsForBatchRender = 1;
  19. global string $remoteMachineNameToRender = "";
  20.  
  21. global proc updateHowManyProcs()
  22. {
  23.     global int $gNumProcessorsForBatchRender;
  24.     int $enabled;
  25.     if (`checkBoxGrp -q -v1 useAllProcs`) {
  26.         $enabled = false;
  27.         $gNumProcessorsForBatchRender = 0;
  28.     } else {
  29.         $enabled = true;
  30.         $gNumProcessorsForBatchRender = `intFieldGrp -q -v1 howManyProcs`;
  31.     }
  32.     intFieldGrp -edit -enable $enabled howManyProcs;
  33.     batchRender -n $gNumProcessorsForBatchRender;
  34. }
  35.  
  36. global proc updateBatchRenderWindowTitle() 
  37. {
  38.     global string $gBatchRenderWindow;
  39.  
  40.     if (`window -q -exists $gBatchRenderWindow`) {
  41.  
  42.         string $title;
  43.         if (`getAttr "defaultRenderGlobals.animation"`) {
  44.             $title = "Batch Render Animation";
  45.         } else {
  46.             $title = "Batch Render Frame";
  47.         }
  48.  
  49.         window -edit -t $title $gBatchRenderWindow;
  50.     }
  51. }
  52.  
  53. global proc batchRenderWindow() 
  54. {
  55.     global int $gNumProcessorsForBatchRender;
  56.     global int $localHostRenderStatus;
  57.     global string $remoteMachineNameToRender;
  58.  
  59.     global string $gBatchRenderWindow = "batchRenderWnd";
  60.  
  61.     if (! `window -q -exists $gBatchRenderWindow`) {
  62.  
  63.         string $title;
  64.         if (`getAttr "defaultRenderGlobals.animation"`) {
  65.             $title = "Batch Render Animation";
  66.         } else {
  67.             $title = "Batch Render Frame";
  68.         }
  69.  
  70.         window -t $title
  71.             -iconName "Batch Render"
  72.             -rtf true $gBatchRenderWindow;
  73.     
  74.         string $parent = `setParent -query`;
  75.         //    Set parent to this window
  76.         setParent $parent;
  77.     
  78.         setUITemplate -pushTemplate DefaultTemplate;
  79.     
  80.         formLayout batchRenderLayout;
  81.         
  82.         // Overall window is layed out as columns
  83.         columnLayout -adj true batchRenderColLayout;
  84.     
  85.             if (!`about -nt` && !`about -mac`) {
  86.                 radioButtonGrp -nrb 2
  87.                     -l "Rendering CPU"
  88.                     -l1 "Local"
  89.                     -l2 "Remote"
  90.                     -select ($localHostRenderStatus + 1)
  91.                     -cc1 "setLocalOrRemoteRender 0; textFieldGrp -e -enable 0 remoteMachineName"
  92.                     -cc2 "setLocalOrRemoteRender 1; textFieldGrp -e -enable 1 remoteMachineName"
  93.                     localOrRemoteMachine;
  94.                 textFieldGrp 
  95.                     -l "Remote Machine Name"
  96.                     -cc "setRemoteRenderMachine"
  97.                     -tx $remoteMachineNameToRender
  98.                     -enable ($localHostRenderStatus != 0)
  99.                     remoteMachineName;
  100.             }
  101.     
  102.                 checkBoxGrp -numberOfCheckBoxes 1
  103.                     -label1 "Use all Available Processors"
  104.                     -v1 ($gNumProcessorsForBatchRender == 0)
  105.                     -cc "updateHowManyProcs"
  106.                     useAllProcs;
  107.         
  108.                 intFieldGrp -label "Number of Processors to Use"
  109.                     -cc "updateHowManyProcs"
  110.                     -v1 $gNumProcessorsForBatchRender 
  111.                     -enable ($gNumProcessorsForBatchRender != 0)
  112.                     howManyProcs;
  113.  
  114.         setParent ..;
  115.     
  116.         button -l "Batch Render" 
  117.             -c "batchRender -f \"\"" 
  118.             batchRenderButton;
  119.         button -l "Close" 
  120.             -c "window -e -visible false $gBatchRenderWindow" 
  121.             batchRenderCloseButton;
  122.     
  123.         setParent ..;
  124.     
  125.         formLayout -edit
  126.             -af batchRenderColLayout "top" 5
  127.             -af batchRenderColLayout "left" 5
  128.             -af batchRenderColLayout "right" 5
  129.             -ac batchRenderColLayout "bottom" 5 batchRenderButton
  130.             -af batchRenderButton "left" 5
  131.             -ap batchRenderButton "right" 5 50
  132.             -af batchRenderButton "bottom" 5
  133.             -ap batchRenderCloseButton "left" 5 50
  134.             -af batchRenderCloseButton "right" 5
  135.             -af batchRenderCloseButton "bottom" 5
  136.             
  137.             batchRenderLayout;
  138.     
  139.         setUITemplate -popTemplate;
  140.     }
  141.  
  142.     if ( `about -evalVersion` ) {
  143.         warning( "Maya Personal Learning Edition limits rendering to a single CPU");
  144.         checkBoxGrp -e -enable false -value1 false useAllProcs;
  145.         intFieldGrp -e -enable false -value1 1 howManyProcs;
  146.     }
  147.  
  148.     showWindow $gBatchRenderWindow;
  149. }
  150.  
  151.  
  152. global proc setRemoteRenderMachine() {
  153.     global string $remoteMachineNameToRender;
  154.     string $remoteName = `textFieldGrp -q -tx remoteMachineName`;
  155.     batchRender -rm $remoteName;
  156.     $remoteMachineNameToRender = $remoteName;
  157. }
  158.  
  159. global proc setLocalOrRemoteRender(int $status) {
  160.     global int $localHostRenderStatus;
  161.     batchRender -um $status;
  162.     $localHostRenderStatus = $status;
  163. }
  164.